header oneWireReadROM
{
	// Empty Header
}

script oneWireReadROM
{
	// Sample Script showing how to discover the ROM code of a 1-wire sensor, in our
	// case, a DS18B20 digital thermometer connected to pins D0-D1
	
	@@openOneWire(#oneWireUsingUART, 0);
	WHILE(1)
	{
	$RESULT=@@resetOneWire();
	PRINT "Connecting to One Wire Sensor: ";
	IF($RESULT)
	{
	PRINT "Ok.", NEWLINE;
	@@sendOneWireCommand(0x33, 64, #oneWireRead, 0);
	PRINT "The ROM Code is: ";
	$A=0;
	WHILE($A<8)
	{
	PRINT "0x", base($$oneWire($A), 16, 2), ".";
	$A=$A+1;
	}
	PRINT NEWLINE;
	@@copyOneWireBufferToRomCodeBuffer(0);
	
	$A=0;
	print "ROM Code: ";
	while($A<8)
	{
	print base($$oneWireRomCode($A), 16, 2), ":";
	$A=$A+1;
	}
	print newline;
	}
	ELSE
	{
	PRINT "Error.", NEWLINE;
	}
	SLEEP(3);
	}
}
